<?php
namespace App\Modules\Shop;

use App\Library\OSS;
use Illuminate\Support\Facades\Cache;

class Manager
{
    public static function getShop()
    {
        return Cache::remember("shop:info", 30, function () {
            return Shop::query()
                ->get()
                ->map(function ($item) {
                    $item->name .= $item->status == Shop::STATUS_CLOSE ? '（关门）' : "";
                    $item->cover = OSS::instance()->getUrl($item->cover);
                    return $item;
                })
                ->keyBy('id');
        });
    }
}
